const mongoose = require("mongoose");
const shopsModel = mongoose.model("shops");

let getShops = async () => {
    const data = await shopsModel.find();
    return data;
}

let deleteShops = async (_id) => {
    const data = await shopsModel.deleteOne({ _id });
    return data;
}

let insertShops = async (shop) => {
    const data = await shopsModel.create(shop);
    return data;
}

let updataShops = async (shop) => {
    const data = await shopsModel.update({ _id: shop._id }, { $set: shop });
    return data;
}

module.exports = {
    getShops, deleteShops, insertShops,updataShops
}